#include "header_obj.h"
#include "vm.h"
#include "class.h"

DEFINE_BUFFER_METHOD(Value)

/**
 * @brief 初始化对象头
*/
void init_objheader(VM *vm, ObjHeader *obj_header, ObjType obj_type, Class *class)
{
    obj_header->type = obj_type;
    // 与GC相关
    obj_header->isdark = false;
    obj_header->class = class;  // 设置meta类
    obj_header->next = vm->allo_objects;  // 设新对象头放在链表头
    vm->allo_objects = obj_header; // 重新指向
}